Binary Logic Executive
Version 2.28, July 2005
=======================

Binary Logic Executive is a tool for building and solving binary logic diagrams in MS Windows.  Simply draw the binary logic diagram using a selection of typical logic elements including OR gates, AND gates, Set-Reset flip-flops, one-shots, and timers.  Configure NOT inverters at either the input or output of each logic element.  Connect these logic elements with segmented lines that can be adjusted to help improve layout.  Drive the logic with Input buttons and continue logic across pages using Connectors.  See the real-time state of all logic with color coded indications using green for true (1 or on) and red for false (0 or off).  Record your thoughts in hints attached to the logic or separate description fields.  Print the logic to a color printer or save it to a file for later use (*1).  Discover its features through a number of example logic diagrams included.

This Delphi application contains a graphical multi-polyline component (TgcMultiPolyline) that interactively draws multi-segment lines on screen.  These lines can be saved to file (via TCollection and Delphi streaming system) and restored at run-time.

This is not cripple ware.  The executable is full function freeware for personal use. The executable (plus optional help file) are all that is needed.  It can be put in any directory where the user has read/write/execute permission.  There is no installation program.  Running the executable does not "install" any files on your computer.  It does not use the Windows Registry or write ini files.

Source Code
-----------
This application is written in Borland's Delphi Pascal programming language.  All source code is provided and should work with Delphi 6 and later, though it likely works on older versions as well.  All custom components are created at run-time, so you don't need to install any components in the Delphi IDE (*2).  The code may be reused for non-commercial purposes as long as credits remain.  Reuse of code commercially requires permission.

File list
---------
{Overview and installation.}
BinaryLogic ReadMe.txt

{Executable files, copy these to any directory for which you have read/write access}
\Executable\BinaryLogic.exe		This is the executable for creating and executing Binary Logic Diagrams.
\Executable\BinaryLogicHelpFile.rtf   	Associated help file.
\Executable\RichEditor.exe        	A simple RTF editor to let users modify the help file.  


{Several example binary logic diagrams.}
\Executable\BLD Examples\Example BLD - Alarm and \Interlock Systems.txt
\Executable\BLD Examples\Example BLD - Circular \Reference Fault.txt
\Executable\BLD Examples\Example BLD - Flip-Flop \Circuits.txt
\Executable\BLD Examples\Example BLD - Misc \Alarming.txt
\Executable\BLD Examples\Example BLD - Traffic Light.txt

{Optional Run Time Object Inspector - install if desired}
\Lib\User\OIUnit.dfm
\Lib\User\OIUnit.pas

{Delphi 7 Source Code files, likely compatible with earlier versions}
\Source\About.dfm
\Source\About.pas
\Source\BinaryLogic.cfg
\Source\BinaryLogic.dpr
\Source\BinaryLogic.res
\Source\BinaryLogicHelpFile.rtf
\Source\Example Alarm and Interlock Systems.txt
\Source\Example Binary Logic.txt
\Source\Example Circular Reference.txt
\Source\gcMultiPolyline.pas
\Source\Globals.pas
\Source\LogicBinaryOp.pas
\Source\LogicConnect.pas
\Source\LogicHelpText.dfm
\Source\LogicHelpText.pas
\Source\LogicMultiOp.pas
\Source\LogicOI.dfm
\Source\LogicOI.pas
\Source\LogicUnaryOp.pas
\Source\LogicWindow.dfm
\Source\LogicWindow.pas
\Source\Resize.dfm
\Source\Resize.pas


Installation
------------
To run the executable, copy the three files in \Executable\ into any directory for which you have read/write access.  

To view/execute example binary logic diagrams, copy any of the five provided files from \Executable\BLD Examples\ to your hard drive.

To view the source code in Delphi, copy all files in \Source\ to your hard drive and click on BinaryLogic.dpr.  If you want access to the run-time object inspector, first install \Lib\User\OIUnit.pas into the Delphi IDE.  Optionally, you can delete this component from the main application with no adverse effects.

Usage and Disclaimer
--------------------
There is no warranty with the software and I take no responsibility for any errors you might encounter.  Binary Logic Executive is unsupported freeware for personal use.  This program can not be re-sold or used for commercial purposes without permission from the author David Casada, a control system engineer in the oil and gas producing industry.  I am interested in constructive feedback at Simada@SprintMail.com.  Please put BLD in the subject line to pass the junk mail filter.  Individual response is not promised.  This was a two year hobby (obsession?) involving early mornings and late nights, holidays programming in the sun on the beach or in the hotel room, and a very supportive wife who is glad it's finally over.

Bug List
Restoring Saved Logic:  Occasionally, one logic element will be misplaced on the screen after restoring saved logic from file.  Usually it is quite obvious as the logic lines are stretched at odd angles to the new location.  Just drag the logic element back to its intended location or re-open the file. Sorry I have no idea what is causing this, but it is tempting to point a finger at the Delphi streaming system or errant propagation of a mouse click from the dialog to the application (after all it couldn't be me).
	
Credits
-------
My TgcMultiPolyline class is partly based on work by Dr Steve Evans (steve@lociuk.com) and his PolylineClass.   This gave me a terrific start for understanding how to draw and manage polylines in Delphi.  

The book "Delphi Component Design", by Danny Thorpe, Addison-Wesley Developers Press (www.aw.com), (c)1997, ISBN 0-201-46136-6, was instrumental in illuminating Borland's philosophy behind Delphi components.  From it I greatly expanded my knowledge of object oriented programming and ability to create custom components, particularly how to use collections and the component streaming system.

BinaryLogic.exe contains a very slightly modified version of "MiTeC Runtime Object Inspector Component" Version 1.1 for Delphi 5,6, Copyright (c) 1999,2002 Michal Mutl.  This tool is great for debugging programs at run-time.  It's also dangerous for non-programmers.  That's why its activation is hidden in the application. 

Notes
-----
(*1) Note that all binary logic is saved in a text file.  The file format is defined by the Delphi object streaming system.  The format is relatively easy to understand and you can modify saved logic with a text editor if you are conscientious.  Fortunately you shouldn't have to, but I have found it useful when making a copy of a whole Sheet to make slight changes.  The key is to rename all components uniquely and increment the component counter TLogicTitle.Count to avoid conflicts with future components added.
(*2) This version includes a run-time Delphi object inspector component.  Programmers will see how to activate it.  It is not "integral" to the main program, so you don't have to install the OI.pas custom component in Delphi IDE unless you wish.

